package com.lwc.cfdns.pojo.bo.system;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.lwc.cfdns.pojo.bo.AbstractPageQuery;
import com.lwc.cfdns.pojo.entity.SystemNotice;
import com.lwc.cfdns.utils.StringUtils;
import lombok.Data;

/**
 * 通知公告搜索
 *
 * @author luwc
 * @title NoticeBO
 * @description
 * @time 2023/6/5 14:43:01
 * @version: 1.0
 */
@Data
public class NoticeBO extends AbstractPageQuery<SystemNotice> {
    private String title;
    private Long cateId;
    private String status;

    /**
     * 生成query conditions
     *
     * @return LambdaQueryWrapper<T>
     * @throws
     * @version 1.0.0
     * @author luwc
     * @time 2023/4/26 20:17:17
     */
    @Override
    public LambdaQueryWrapper<SystemNotice> toQueryWrapper() {
        LambdaQueryWrapper<SystemNotice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        if (StringUtils.isNotEmpty(getTitle())) {
            lambdaQueryWrapper.like(SystemNotice::getTitle, getTitle());
        }
        if (StringUtils.isNotNull(getCateId())) {
            lambdaQueryWrapper.eq(SystemNotice::getCateId, getCateId());
        }
        if (StringUtils.isNotEmpty(getStatus())) {
            lambdaQueryWrapper.eq(SystemNotice::getStatus, getStatus());
        }
        return lambdaQueryWrapper;
    }
}
